using System;
using battlenet.wow.rt.domain.objects;
using battlenet.wow.rt.sdk.data.dto;
using battlenet.wow.rt.sdk.utility;

namespace battlenet.wow.rt.sdk.objects.mapper
{
    internal class ItemSpellMapper : Remapper<ItemSpell>
    {
        public override void RegisterMappers()
        {
            Register(typeof(ItemSpellInfo), input => Map(input as ItemSpellInfo));
        }

        internal ItemSpell Map(ItemSpellInfo info)
        {
            var itemSpell = new ItemSpell
            {
                CategoryId = info.CategoryId,
                Charges = info.Charges,
                Consumable = info.Consumable,
                SpellId = info.SpellId,
                Trigger = info.Trigger,
                Spell = info.Spell.Remap(new SpellMapper())
            };

            return itemSpell;
        }
    }
}